#include <bits/stdc++.h>
using namespace std;
struct TreeNode {
	int val;
	TreeNode *left;
	TreeNode *right;
	TreeNode() : val(0), left(nullptr), right(nullptr) {}
	TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
	TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(left), right(right) {}
};
class Test{
public:
	void traversal(TreeNode* node,vector<int>& path,vector<string>& result){
		path.push_back(node->val);
		if(node->right == NULL && node->left == NULL){
			string sPath;
			for(int i = 0;i < path.size() - 1;i++){
				sPath += to_string(path[i]);
				sPath += "->";
			}
			sPath += to_string(path[path.size()-1]);
			result.push_back(sPath);
		}
		if(node->left){
			traversal(node->left,path,result);
			path.pop_back();
		}
		if(node->right){
			traversal(node->right,path,result);
			path.pop_back();
		}
	}
	vector<string> binaryTreePaths(TreeNode* root) {
		vector<int> path;
		vector<string> result;
		if(root == NULL){
			return result;
		}
		traversal(root,path,result);
		return result;
	}
};



int main(){
	
	
	return 0;
}
